package com.example.ross.utils;

import com.example.ross.model.ResultFormat;

/**
 * 统一返回工具
 * @author RossZhang
 * @version 1.0
 * @date 2020/7/16
 */
public class ResultUtil {

    /**
     * 返回成功信息
     * @param obj
     * @return
     */
    public static ResultFormat success(Object obj){
        ResultFormat result = new ResultFormat();
        result.setCode(200);
        result.setMsg("成功！");
        result.setData(obj);
        return result;
    }

    public static ResultFormat success(){
        return success(null);
    }

    public static ResultFormat error(Integer code,String msg){
        ResultFormat result = new ResultFormat();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
